Skip to content

chore(deps): upgrade react-router to v8.3.0 and drop react-router-dom - #219

Merged
therealsama merged 1 commit into
mainfrom
chore/react-router-v8
Aug 7, 2026
Merged

therealsama merged 1 commit into
mainfrom
chore/react-router-v8

Conversation

@therealsama

Copy link
Copy Markdown
Collaborator

Summary

Upgrades react-router from 7.18.1 to 8.3.0 and removes the react-router-dom package. No user-visible behavior change — this is a dependency and import-path migration that clears a security advisory blocking CI.

Why now. The dependency-review check fails on #218 because bumping react-router-dom 7.18.1 → 7.18.2 pulls in react-router@7.18.2, which matches GHSA-qwww-vcr4-c8h2 (high, CVSS 4.0 7.1).

Three things make this worth fixing properly rather than suppressing:

  • main is already exposed. The vulnerable range is >= 7.12.0, < 8.3.0 and main sits on 7.18.1. dependency-review only inspects dependencies changed in the PR diff, so the existing 7.18.1 goes unnoticed while the functionally identical 7.18.2 gets blocked. chore(deps): bump the prod-minor-patch group across 1 directory with 7 updates #218 was not adding risk, only making it visible.
  • It would block indefinitely. The first patched version is 8.3.0, a major. Dependabot's prod-minor-patch group is limited to minor/patch, so it structurally cannot ever propose the fix, and every future react-router 7.x bump would fail the same gate.
  • It was never exploitable here. The advisory states it "only affects your application if you are using the unstable RSC APIs." HackerTok is a static GitHub Pages SPA using HashRouter in declarative mode, with no server and no RSC.

What changed. v8 removes the react-router-dom package (its latest release is 7.18.2 — it is now a dead package), so the dependency is replaced with react-router and the import specifier is updated across 26 files. All ten symbols in use — HashRouter, Link, MemoryRouter, NavigationType, Route, Routes, useLocation, useNavigate, useNavigationType, useParams — are exported from the v8 root entry point, so no API rewrites were needed. useScrollRestore.test.ts needed slightly more than a specifier swap because it mocks the router module, so its vi.mock target and type alias were renamed too.

The v8 prerequisites are already met: Node ≥ 22.22.0 (CI runs Node 24) and React ≥ 19.2.7 (currently 19.2.7). Remaining v8 breaking changes concern framework/data mode — middleware, meta APIs, loader request handling — none of which this app uses. The manualChunks rule in vite.config.js matches on node_modules/react-router and is unaffected.

After this lands, #218 will rebase and drop the now-obsolete react-router-dom entry, leaving its other six updates and a passing dependency-review.

Related issues

Unblocks #218.

Screenshots or recordings

None — no UI change.

Checklist

  • Changes are focused and avoid unrelated refactors
  • Tests were added or updated when behavior changed (no behavior change; existing suites cover the routing paths)
  • Accessibility and mobile behavior were considered (full Playwright suite passes across Chromium, Firefox, Mobile Safari and Mobile Chrome, including the axe-core accessibility specs)

Verification

Everything CI runs was run locally against this branch:

  • npm run typecheck — clean
  • npm run lint — clean
  • npm run test:run — 964 passed across 54 files
  • npm run build — succeeds, chunking unchanged
  • npm run e2e — 655 passed, 14 skipped, across all four browser projects

npm ls react-router resolves 8.3.0 and react-router-dom is gone, so the advisory is removed rather than allowlisted. The remaining npm audit findings (brace-expansion, protobufjs, @babel/core) all predate this branch and are unrelated.

react-router 7.x is covered by GHSA-qwww-vcr4-c8h2 (high), whose vulnerable
range is >=7.12.0 <8.3.0 with no 7.x patch. This fails the dependency-review
CI gate on every Dependabot bump that touches react-router, and since the
prod-minor-patch group is limited to minor/patch updates it can never reach
the fix on its own.

The advisory only affects the unstable RSC APIs, which this static HashRouter
SPA does not use, so it was never exploitable here. Upgrading resolves it
outright rather than suppressing it.

v8 removes the react-router-dom package, so the dependency is replaced with
react-router and imports are updated across the app. All symbols in use
(HashRouter, Link, MemoryRouter, NavigationType, Route, Routes, useLocation,
useNavigate, useNavigationType, useParams) are exported from the v8 root
entry point, so no API changes were needed. The v8 requirements of Node
>=22.22.0 and React >=19.2.7 are already satisfied.
@therealsama
therealsama requested a review from kplachkov as a code owner August 7, 2026 07:57
@therealsama
therealsama enabled auto-merge August 7, 2026 10:14
@therealsama
therealsama merged commit ee15df1 into main Aug 7, 2026
4 checks passed
@therealsama
therealsama deleted the chore/react-router-v8 branch August 7, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants